package org.applet.game.framework.map;

import java.util.ArrayList;
import java.util.LinkedList;

public class PathUtil {

	public static ArrayList<Node> smooth(LinkedList<Node> path)
	{
		ArrayList<Node> p = new ArrayList<Node>(path.size() * 10);
		Node last = path.get(0);
		int index = 0;
		p.add(new Node(last.X*20+10, last.Y*20+10));
		for(Node n : path)
		{
			if(index++ == 0)
				continue;
			int offsetX = (n.X-last.X)*2;
			int offsetY = (n.Y-last.Y)*2;
			for(int i=1;i<=10;i++)
			{
				p.add(new Node(last.X*20+offsetX*i+10, last.Y*20+offsetY*i+10));
			}
			last = n;
		}
		return p;
	}
}
